package com.wyh.controller.groupOne.titleReview;


import com.wyh.common.result.Result;
import com.wyh.domain.vo.groupOne.titleReview.GetInvoiceheaderVO;
import com.wyh.domain.vo.groupOne.titleReview.MasterDataInvoiceheaderVO_2;
import com.wyh.service.groupOne.titleReview.MasterDataIInvoiceheaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 发票抬头表 前端控制器
 * </p>
 *
 * @author lsf
 * @since 2024-05-28
 */
@RestController
@RequestMapping("/invoiceheader")
public class InvoiceheaderController {


    @Autowired
    private MasterDataIInvoiceheaderService invoiceheaderService;

    /**
     * 查询发票抬头表
     * @param getInvoiceheaderVO
     * @return
     */
    @PostMapping("/getAudit")
    public Result<List<MasterDataInvoiceheaderVO_2>> getAudit(@RequestBody GetInvoiceheaderVO getInvoiceheaderVO){


        return  invoiceheaderService.getAudit(getInvoiceheaderVO);
    }


    /**
     * 通过该发票(target=1)
     * @param masterDataInvoiceheaderVO2
     * @return
     */
    @PostMapping("/adopt")
    public Result adopt(@RequestBody MasterDataInvoiceheaderVO_2 masterDataInvoiceheaderVO2){
        return  invoiceheaderService.auditing(masterDataInvoiceheaderVO2,1);

    }
    /**
     * 驳回该发票(target=2)
     * @param masterDataInvoiceheaderVO2
     * @return
     */
    @PostMapping("/rejected")
    public Result rejected(@RequestBody MasterDataInvoiceheaderVO_2 masterDataInvoiceheaderVO2){
        return  invoiceheaderService.auditing(masterDataInvoiceheaderVO2,2);

    }

    /**
     * 撤销该发票审核(target=0)
     * @param masterDataInvoiceheaderVO2
     * @return
     */
    @PostMapping("/revoke")
    public Result revoke(@RequestBody MasterDataInvoiceheaderVO_2 masterDataInvoiceheaderVO2){
        return  invoiceheaderService.auditing(masterDataInvoiceheaderVO2,0);

    }
}
